package com.clms.rents.controller;

import com.clms.common.R;
import com.clms.rents.pojo.entity.TbCarType;
import com.clms.rents.pojo.entity.TbCarTypeConfigDetails;
import com.clms.rents.pojo.vo.CarConfigVo;
import com.clms.rents.pojo.vo.CarTypeVo;
import com.clms.rents.service.CarConfigService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-third
 * @description: 汽车配置表controller层
 * @author: 杨浩
 * @create: 2021-07-22 10:45
 **/
@RestController
@RequestMapping("rents/config")
public class CarConfigController {

    @Resource
    private CarConfigService carConfigService;

    @GetMapping("selectall")
    public R selectAll(){
        return carConfigService.selectAll();
    }//


    @PostMapping("pageSelect/{currentPage}/{pageSize}")
    public R pageSelect(@PathVariable Integer currentPage,
                        @PathVariable Integer pageSize,
                        @RequestBody CarConfigVo carConfigVo){
        return carConfigService.pageSelect(currentPage,pageSize,carConfigVo);
    }
    @PostMapping("insert")
    public R insert(@RequestBody TbCarTypeConfigDetails tbCarTypeConfigDetails){
        return carConfigService.insert(tbCarTypeConfigDetails);
    }

    @GetMapping("selectById/{id}")
    public R selectByid(@PathVariable Integer id){
        return carConfigService.selectById(id);
    }

    @PutMapping("update")
    public R update(@RequestBody TbCarTypeConfigDetails tbCarTypeConfigDetails){
        return carConfigService.update(tbCarTypeConfigDetails);
    }
    @DeleteMapping
    public R delete(@RequestParam Integer id){
        return carConfigService.delete(id);
    }
}
